//
//  Copyright 2015 XiaoJSoft Studio.
//  Copyright 2015 Harbin Institute of Technology(HIT), Software Engineering Department.
//
//  Use of this source code is governed by a proprietary license. You can not read, change or
//  redistribute this source code unless you have a written authorization from the copyright
//  holder listed above.
//

#ifndef GRAPH_H_
#define GRAPH_H_

#include <vector>

namespace ui {
namespace compiler {

class DirectedGraph {
public:
    DirectedGraph(const unsigned int vertex_count);
    ~DirectedGraph();
    void addEdge(const unsigned int source_vertex, const unsigned int target_vertex);
    unsigned int getVertexCount();
    void getAdjacentVertexes(const unsigned int vertex_id, std::vector<unsigned int> &output);
    bool doToposort(std::vector<unsigned int> &output);
private:
    unsigned int m_VertexCount;
    std::vector< std::vector<unsigned int> > m_Links;
};

}  //  namespace compiler
}  //  namespace ui

#endif  //  GRAPH_H_
